# -*- coding;utf-8 -*-
"""
File name : ChoiceQuestionOption.PY
Program IDE : PyCharm
Create file time: 2023/10/30 23:03
File Create By Author : 朱清闯
"""
import re
regular_rule_content = r'(.*)A\.'
regular_rule_A = r'A\.(.*)B\.'
regular_rule_B = r'B\.(.*)C\.'
regular_rule_C = r'C\.(.*)D\.'
regular_rule_D = r'D\.(.*)'


def get_option(content):
    option_dic = {}
    flag = False
    content_no_option = ''
    if not re.search(regular_rule_A, content, re.M) or \
            (not re.search(regular_rule_B, content, re.M)) or \
            (not re.search(regular_rule_C, content, re.M)) or \
            not re.search(regular_rule_D, content, re.M):
        return flag, option_dic, content_no_option
    option_dic['A'] = re.search(regular_rule_A, content, re.M).group(1)
    option_dic['B'] = re.search(regular_rule_B, content, re.M).group(1)
    option_dic['C'] = re.search(regular_rule_C, content, re.M).group(1)
    option_dic['D'] = re.search(regular_rule_D, content, re.M).group(1)
    content_front_no_option = re.search(regular_rule_content, content, re.M).group(1)
    flag = True
    return flag, option_dic, content_front_no_option
